package crack.lshape.tri_structure_mesh;

import java.io.IOException;

import math2.MathUtilities;
import fem2.AbstractStructuralCrackDemo;
import fem2.Element;
import fem2.MaterialModel;
import fem2.MeshPart;
import fem2.Model;
import fem2.element.crack_sda.SKONConstantJumpCSTElementUsingRecoverStress;
import fem2.enu.State;
import fem2.material.StVenantKirchhoffMM;
import fem2.material.SPRrecoveryMM;
import fem2.material.cohesive_law.CohesiveLaw;

public class LshapeTriStructuredMeshSKONConstantJumpCSTElementRecover2AndJirasekExponentialCohesiveLaw
		extends LshapeTriStructuredMeshSKONConstantJumpCSTElementAndJirasekExponentialCohesiveLaw {

	public LshapeTriStructuredMeshSKONConstantJumpCSTElementRecover2AndJirasekExponentialCohesiveLaw() {
		meshFileName = "mesh4-skon-recover2-jirasek.msh";
	}

	@Override
	public Element createElement(MeshPart mp, MaterialModel mm, CohesiveLaw cl) {
		Element e = new SKONConstantJumpCSTElementUsingRecoverStress(mp, mm, cl);
		return e;
	}

	@Override
	public MaterialModel createMaterial(Model m) {
		double E = 25850;
		double nu = 0.18;
		double t = 200;
		State ss = State.PLANE_STRESS;
		MaterialModel mm = new SPRrecoveryMM(m, new StVenantKirchhoffMM(E, nu, t, 0, ss));
		return mm;
	}

	public static void main(String[] args) throws IOException {

		AbstractStructuralCrackDemo sample = new LshapeTriStructuredMeshSKONConstantJumpCSTElementRecover2AndJirasekExponentialCohesiveLaw();

		// double[] lambda = MyLinAlg.createLambdaArray(10.95, 0.05, 11);
		// double[] lambda = MyLinAlg.createLambdaArray(10.95, 0.05, 15);
		// double[] lambda = MyLinAlg.createLambdaArray(10.95, 0.05, 25);
		// double[] lambda = MyLinAlg.createLambdaArray(10.95, 0.1, 35);
		// double[] lambda = MyLinAlg.createLambdaArray(10.95, 0.1, 45);
		double[] lambda = MathUtilities.createLambdaArray(10.95, 0.1, 55); // not
																				// converged

		sample.run(lambda);

	}
}
